<? 
	if(isset($_POST['btnsubmit']))
	{
		require("required/dbconnect.php");
		require("required/function.php");		
		$id=de_id($_POST['id']);
		$title_eng=mysql_real_escape_string($_POST['title_eng']);
		$content_eng=mysql_real_escape_string($_POST['content_eng']);
		$type=$_POST['type'];
		
		$update=mysql_query("update os_news set title_eng='$title_eng',content_eng='$content_eng' where id=$id")or die(mysql_error());
		header("Location:events_edit.php?type=$type&msg=1&id=".$_POST['id']);
	}
	
	$title="Edit category"; 
	$pageid="5";
	$accessid="a00";
	
	require("required/dbconnect.php"); 
	require("required/function.php");
	require("required/header.php");
	
	checkAccess("allow_content_management",1); 
?>
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?	
	
	$id=de_id($_GET['id']);
	$enid=$_GET['id'];
	$get_info=mysql_query("select * from os_news where id=$id");
	
	if(mysql_num_rows($get_info)==0)
	{
		echo "No record found!!";
	}
	else
	{
		
	if(empty($_GET['msg'])){
		$msg="";
	}else{
		$msg="<div class='dw_success'>Data Updated</div>";
		echo "<script>displayMsg('divMsg')</script>";	
	}
	$a=mysql_fetch_array($get_info,MYSQL_ASSOC);
	$type=$a['type'];
	
?>
<table width="100%" cellpadding="2" cellspacing="1">
	
	<td valign="top">
	<table width="100%">
	<tr>
		<td colspan="4" class="title"><strong>Edit <?= $a['title_eng'] ?></strong></td>
	</tr>
	<tr>
		<td colspan="4"> <div id="divMsg"><?= $msg ?></div></td>
	</tr>
	<script type="text/javascript" src="required/js/calendarDateInput.js"></script>	

				</script>	
	<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="frm" onSubmit="return frmValidate(this)">
	<input type="hidden" value="<?= $enid ?>" name="id">
    <input type="hidden" value="<?= $a['type'] ?>" name="type">
	
	
	<tr>
		<td>Title</td><td>:</td><td><input type="text" value="<?= $a['title_eng'] ?>" name="title_eng" size="50" maxlength="200" /></td>
	</tr>
	
	<tr valign="top">
		<td width="18%">Content</td><td width="2%">:</td><td width="80%">
		<? include_once("fckeditor/fckeditor.php") ?>
		<?php
			$oFCKeditor = new FCKeditor('content_eng') ;
			$oFCKeditor->ToolbarSet = 'DeswinBasic';
			$oFCKeditor->BasePath = './fckeditor/' ;
			$oFCKeditor->Value = $a["content_eng"] ;
			$oFCKeditor->Create() ;
		?>
		</td>
	</tr>
	
	<tr>
		<td colspan="3" align="center"><br><input type="submit" value="Update" class="button" name="btnsubmit">  <input type="button" value="Cancel" class="button" onclick="window.open('events.php?type=<?= $type ?>','_self')"><br><br></td>
	</tr>
	</form>
	</table></td>
			
</table>
<? } require("required/footer.php"); ?>

